@extends('layouts.root')

@section('title' , '客户后台')

@section('styles')
    <link rel="stylesheet" href="{{ asset('layuiadmin/style/template.css') }}">
@endsection


@section('contents')
    <!-- 主体内容 -->
    <div class="" style="background: #e3e3e3;">
        {{--搜索框添加--}}
        <div class="layui-fluid">
            <div class="layui-card">
                <div class="layui-form layui-card-header layuiadmin-card-header-auto">
                    <div class="layui-form-item">
                        {{--// 搜索框添加--}}
                        <div class="layui-inline">
                            <div class="">
                                <input type="text" name="goods_name" placeholder="商品名" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <div class="">
                                <input type="text" name="price" placeholder="价格" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline" style="width:100px;">
                            <div class="">
                                <select name="limits">
                                    <option value="">查询条数</option>
                                    <option value="1">10</option>
                                    <option value="50">50</option>
                                    <option value="100">100</option>
                                    <option value="500">500</option>
                                    <option value="1000">1000</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <div class="">
                                <input type="text" class="layui-input" style="width:170px;" id="test16"
                                       placeholder="开始时间 到 结束时间" name="times">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <button class="layui-btn layuiadmin-btn-useradmin" lay-submit lay-filter="LAY-user-back-search">
                                <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                            </button>
                        </div>
                    </div>
                </div>
                <div class="layui-card-body demoTable">
                    <div style="padding-bottom: 10px;">
                        <button class="layui-btn layuiadmin-btn-useradmin" data-type="add">添加</button>
                    </div>
                </div>
            </div>
        </div>

        {{--商品列表--}}
        @include('layouts.goodsList')
    </div>
@stop


@section('scripts')
<script>
    layui.config({
        base: '/layuiadmin/'
    }).extend({
        index: 'lib/index',
    }).use(['laypage','index','form'],function(){
        var $ = layui.$
            ,form = layui.form
            ,laypage = layui.laypage
            ,layer = layui.layer;

        //总页数低于页码总数
        laypage.render({
            elem: 'demo0'
            ,limits: 1 //数据条
            ,count: "{{ $goodslist->count() }}" //数据总数
        });


        layer.closeAll();

        var active = {
            add: function () { // 添加
                layer.open({
                    type:2
                    ,offset: '100px' // 显示定位
                    ,area: ['70%','70%'] // 弹出框大小
                    ,title: '添加商品' //不显示标题栏
                    ,shade: 0.8
                    ,shadeClose:true
                    ,id: 'LAY_layuipro' //设定一个id，防止重复弹出
                    ,content:"{{ route('zbsuser.goods.create') }}",
                })
            }
        };

        $('.demoTable .layui-btn').on('click', function(){
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
    });
</script>
@endsection